import os

from llama_index.core import VectorStoreIndex, SimpleDirectoryReader

if __name__ == "__main__":
    os.environ["OPENAI_API_KEY"] = os.environ["OPENAI_API_KEY_ZHIHU"]
    os.environ["OPENAI_API_BASE"] = os.environ["OPENAI_API_BASE_ZHIHU"]
    os.environ["OPENAI_BASE_URL"] = os.environ["OPENAI_API_BASE_ZHIHU"]

    documents = SimpleDirectoryReader("./llamaIndexDatas",recursive=True,required_exts=[".pdf"]).load_data()
    index = VectorStoreIndex.from_documents(documents)

    query_engine = index.as_query_engine()

    response = query_engine.query("llama2有多少参数")
    print(response)